import {ipcRenderer, IpcRendererEvent} from "electron";
import {setApi} from "./base";

const api = {
  on: (
    channel: string,
    listener: (...args: any[]) => void,
  ) => {
    ipcRenderer.removeAllListeners(channel)
    ipcRenderer.on(channel, (ev, ...a) => {
      listener.apply(null, a)
    });
  },
  downloadUpdate() {
    ipcRenderer.send("downloadUpdate")
  },
  quitAndInstall() {
    ipcRenderer.send("quitAndInstall")
  }
};

setApi(api)